<template name="socity">
	<view class="community-container padding-top-100" style="height: 100vh;"
		:style="{background:'url('+Imgbase+'/new_goodmy_bgc.png)','background-size':'100%',}">

		<view class="community-top h-1400 w100 "
			:style="{background:'url('+Imgbase+'/new_goodsoc_bgc2.png)','background-size':'100%',}">

			<view class="flex-between padding-top-90 padding-left-100 padding-right-60">
				<view class="w-160 h-160 padding-top-10" @click="toPage('index','rank')">
					<!-- <image class="w100 h100" :src="Imgbase + '/socity_5.png'" mode="aspectFit"></image> -->
					<image class="w100 h100" :src="Imgbase + '/new_goodsoc_img2n.png'" mode="aspectFit"></image>
				</view>


				<view class="w-170 h-170">
					<image class="w100 h100" @click="toPage('index','Pray',pray_number)"
						:src="Imgbase + '/new_goodsoc_lucknum'+ pray_number  +'.png'" mode="aspectFit"></image>
				</view>
				<view class="w-160">

				</view>
				<!-- 免费抽奖 -->
				<!-- <view class="h-150" @click="gofree">
						<image class="w100 h100" :src="Imgbase + '/1zhan_new_chou.png'" mode="aspectFit"></image>
					</view> -->

			</view>

			<view class="padding-top-170 text-center w100">
				<view class="w-600 h-100" style="margin: 0 auto -45rpx;position: relative;z-index: 99;">
					<image class="w100 h100" :src="Imgbase + '/new_goodsoc_img5n.png'" mode="aspectFit"></image>
				</view>

				<view class="w100">
					<button class="w100 h-300"
						style="display: flex;justify-content: right;overflow: hidden;background-color:transparent;"
						open-type="share">
						<image class="w100 h-300" :src="Imgbase + '/new_goodsoc_img6n.png'" mode="aspectFit">
						</image>
					</button>
				</view>

			</view>
		</view>



		<view class="cu-modal" :class="modalName=='Modal'?'show':''" @tap="hideModal">
			<view class="cu-dialog" style="background-color:initial;">
				<view class="bg-img"
					:style="{background:'url('+Imgbase+'/noproject2.png) no-repeat','background-size':'100% 100%','height':'460rpx'}">
				</view>
			</view>
		</view>

		<view class="w100 h-160 tabbars ">
			<view class="flex-between h-140 padding-left-90 padding-right-90" style="position: relative;z-index: 999;">
				<view class="" @click="seletab(1)">
					<view class="w-120 h-140 text-center padding-bottom-10">
						<image :src=" Imgbase+'/new_good_tab1.png'" mode="aspectFit" class="w100 h100 margin-top-10">
						</image>
					</view>
				</view>
				<view class="" @click="seletab(4)">
					<view class="w-120 h-120 text-center">
						<image :src=" Imgbase+'/new_good_tab4.png'" mode="aspectFit" class="w100 h100 margin-top-10">
						</image>
					</view>
				</view>
				<view class="padding-bottom-10" @click="seletab(5)">
					<view class="w-120 h-120 text-center">
						<image :src=" Imgbase+'/new_good_tab5.png'" mode="aspectFit" class="w100 h100 margin-top-10">
						</image>
					</view>
				</view>
			</view>
			<view class="bgcs">

			</view>
			<view class="bgcs_top">

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "socity",
		data() {
			return {
				Imgbase: getApp().globalData.Imgbase,
				activitylist: [],
				modalName: null,
				pray_number: 0,
				PageCur: 4,
				uid: 0
			};
		},
		onShow() {
			uni.hideTabBar()
			if (uni.getStorageSync('token') == '') {
				this.$uniApi.trylogin();
			}
			this.loadlist();
		},
		mounted() {
			console.log(1)
		},
		// 分享
		onShareAppMessage(res) {
			let _this = this;
			console.log(res.from)
			if (res.from == 'menu') {
				return {
					title: '',
					path: '/pages/goodspoor/index',
					imageUrl: 'https://oqyf-1305090490.cos.ap-shanghai.myqcloud.com/front/1zhan_new_logo.png',
				}
			} else {
				return {
					title: '好友助力',
					path: '/pagesA/newpage/Assist?id=' + _this.uid,
					imageUrl: 'https://oqyf-1305090490.cos.ap-shanghai.myqcloud.com/front/1zhan_new_logo.png',
				}
			}

		},
		methods: {
			gofree() {
				uni.navigateTo({
					url: '/pagesA/newpage/rankinglist',
					// 	url: '/pagesA/advanced/free'
				})
			},
			seletab(i) {
				this.PageCur = i
				switch (i) {
					case 1:
						uni.switchTab({
							url: '/pages/goodspoor/index'
						})
						break;
					case 2:
						uni.switchTab({
							url: '/pages/goodspoor/backpack'
						})
						break;
					case 3:
						uni.switchTab({
							url: '/pages/index/kpindex'
						})
						break;
					case 4:
						uni.switchTab({
							url: '/pages/goodspoor/socity'
						})
						break;
					case 5:
						uni.switchTab({
							url: '/pages/goodspoor/user'
						})
						break;
				}
			},
			toPage(folder, name, id = -1) {
				if (id == -1) {
					uni.navigateTo({
						url: `/pages/${folder}/${name}`
					});
				} else {
					uni.navigateTo({
						url: `/pages/${folder}/${name}?id=${id}`
					});
				}
			},
			loadlist() {
				let _this = this;
				uni.request({
					url: _this.$globals.apibase + '/api/Index/activityList',
					data: {},
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					success: (res) => {
						if (res.data.code == '401') {
							uni.setStorageSync('token', '');
						}
						if (res.data.code == '1') {
							_this.activitylist = res.data.data.list
						}
						if (res.data.code == '0') {
							uni.showToast({
								icon: 'none',
								title: res.data.msg
							});
						}
					}
				});
				uni.request({
					url: _this.$globals.apibase + '/api/Userways/userFront',
					data: {
						token: uni.getStorageSync('token'),
					},
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					success: (res) => {
						if (res.data.code == '401') {
							uni.setStorageSync('token', '');
							// _this.$uniApi.trylogin('socity');
						}
						if (res.data.code == '1') {
							_this.pray_number = res.data.data.user_desc.pray_number;
							_this.uid = res.data.data.user_desc.id;
						}
					}
				});
			},
			showActivity(id, index) {
				if (this.activitylist[index]['ways'] == 0) {
					uni.navigateTo({
						url: `/pages/index/activitydetail?id=${id}`
					});
				}
				if (this.activitylist[index]['ways'] == 1) {
					uni.navigateTo({
						url: `/pages/` + this.activitylist[index]['page1'] + `/` + this.activitylist[index][
							'page2'
						]
					});
				}
			},
			noproject() {
				this.modalName = 'Modal';
			},
			hideModal(e) {
				this.modalName = null
			},
		},
	}
</script>

<style lang="less" scoped>
	button:after {
		border: none;
	}

	.fl {
		float: left;
	}

	.fr {
		float: right;
	}

	/*组件背景颜色*/
	.zr {
		background: #AEE2DA;
		width: 100%;
		height: 400rpx;
		position: relative;
	}

	.water {
		position: absolute;
		left: 0;
		bottom: -10px;
		height: 30px;
		width: 100%;
		z-index: 1
	}

	.water-c {
		position: relative
	}

	.water-1 {
		background: url("") repeat-x;
		background-size: 600rpx;
		-webkit-animation: wave-animation-1 3.5s infinite linear;
		animation: wave-animation-1 3.5s infinite linear
	}

	.water-2 {
		top: 5px;
		background: url("") repeat-x;
		background-size: 600rpx;
		-webkit-animation: wave-animation-2 6s infinite linear;
		animation: wave-animation-2 6s infinite linear
	}

	.water-1,
	.water-2 {
		position: absolute;
		width: 100%;
		height: 60rpx;
	}

	.back-white {
		background: #fff
	}

	@keyframes wave-animation-1 {
		0% {
			background-position: 0 top
		}

		100% {
			background-position: 600rpx top
		}
	}

	@keyframes wave-animation-2 {
		0% {
			background-position: 0 top
		}

		100% {
			background-position: 600rpx top
		}
	}
</style>